.class public Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;
.super Landroid/widget/CursorAdapter;
.source "DownloadAdapter.java"


# instance fields
.field private mContext:Landroid/content/Context;

.field private final mCurrentBytesColumnId:I

.field private mCursor:Landroid/database/Cursor;

.field private final mDateColumnId:I

.field private mDateFormat:Ljava/text/DateFormat;

.field private mDownloadSelectionListener:Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;

.field private mExecutorService:Ljava/util/concurrent/ExecutorService;

.field private mHandler:Landroid/os/Handler;

.field private final mIdColumnId:I

.field private mLocalUriColumnId:I

.field private final mMediaTypeColumnId:I

.field private final mReasonColumnId:I

.field private mResources:Landroid/content/res/Resources;

.field private final mStatusColumnId:I

.field private mTimeFormat:Ljava/text/DateFormat;

.field private final mTitleColumnId:I

.field private final mTotalBytesColumnId:I


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/database/Cursor;Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;)V
    .registers 6
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "cursor"    # Landroid/database/Cursor;
    .param p3, "selectionListener"    # Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;

    .prologue
    .line 76
    invoke-direct {p0, p1, p2}, Landroid/widget/CursorAdapter;-><init>(Landroid/content/Context;Landroid/database/Cursor;)V

    .line 72
    invoke-static {}, Ljava/util/concurrent/Executors;->newSingleThreadExecutor()Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mExecutorService:Ljava/util/concurrent/ExecutorService;

    .line 73
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mHandler:Landroid/os/Handler;

    .line 77
    iput-object p1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mContext:Landroid/content/Context;

    .line 78
    iput-object p2, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    .line 79
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mResources:Landroid/content/res/Resources;

    .line 80
    iput-object p3, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mDownloadSelectionListener:Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;

    .line 81
    const/4 v0, 0x3

    invoke-static {v0}, Ljava/text/DateFormat;->getDateInstance(I)Ljava/text/DateFormat;

    move-result-object v0

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mDateFormat:Ljava/text/DateFormat;

    .line 82
    new-instance v0, Ljava/text/SimpleDateFormat;

    const-string v1, "HH:mm"

    invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mTimeFormat:Ljava/text/DateFormat;

    .line 84
    const-string v0, "_id"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mIdColumnId:I

    .line 85
    const-string v0, "title"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mTitleColumnId:I

    .line 86
    const-string v0, "status"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mStatusColumnId:I

    .line 87
    const-string v0, "reason"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mReasonColumnId:I

    .line 88
    const-string v0, "total_size"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mTotalBytesColumnId:I

    .line 89
    const-string v0, "bytes_so_far"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCurrentBytesColumnId:I

    .line 90
    const-string v0, "media_type"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mMediaTypeColumnId:I

    .line 91
    const-string v0, "last_modified_timestamp"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mDateColumnId:I

    .line 92
    const-string v0, "local_uri"

    invoke-interface {p2, v0}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mLocalUriColumnId:I

    .line 93
    return-void
.end method

.method private getDateString()Ljava/lang/String;
    .registers 5

    .prologue
    .line 146
    new-instance v0, Ljava/util/Date;

    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    iget v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mDateColumnId:I

    invoke-interface {v1, v2}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v2

    invoke-direct {v0, v2, v3}, Ljava/util/Date;-><init>(J)V

    .line 147
    .local v0, "date":Ljava/util/Date;
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->getStartOfToday()Ljava/util/Date;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/Date;->before(Ljava/util/Date;)Z

    move-result v1

    if-eqz v1, :cond_1e

    .line 148
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mDateFormat:Ljava/text/DateFormat;

    invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v1

    .line 150
    :goto_1d
    return-object v1

    :cond_1e
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mTimeFormat:Ljava/text/DateFormat;

    invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v1

    goto :goto_1d
.end method

.method private getSizeText(J)Ljava/lang/String;
    .registers 8
    .param p1, "totalBytes"    # J

    .prologue
    .line 172
    const-string v0, ""

    .line 173
    .local v0, "sizeText":Ljava/lang/String;
    const-wide/16 v2, 0x0

    cmp-long v1, p1, v2

    if-ltz v1, :cond_e

    .line 174
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mContext:Landroid/content/Context;

    invoke-static {v1, p1, p2}, Landroid/text/format/Formatter;->formatFileSize(Landroid/content/Context;J)Ljava/lang/String;

    move-result-object v0

    .line 176
    :cond_e
    return-object v0
.end method

.method private getStartOfToday()Ljava/util/Date;
    .registers 4

    .prologue
    const/4 v2, 0x0

    .line 155
    new-instance v0, Ljava/util/GregorianCalendar;

    invoke-direct {v0}, Ljava/util/GregorianCalendar;-><init>()V

    .line 156
    .local v0, "today":Ljava/util/Calendar;
    const/16 v1, 0xb

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 157
    const/16 v1, 0xc

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 158
    const/16 v1, 0xd

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 159
    const/16 v1, 0xe

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 161
    invoke-virtual {v0}, Ljava/util/Calendar;->getTime()Ljava/util/Date;

    move-result-object v1

    return-object v1
.end method

.method private getStatusStringId(I)I
    .registers 6
    .param p1, "status"    # I

    .prologue
    .line 180
    sparse-switch p1, :sswitch_data_42

    .line 199
    new-instance v0, Ljava/lang/IllegalStateException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Unknown status: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    iget v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mStatusColumnId:I

    invoke-interface {v2, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 182
    :sswitch_24
    sget v0, Lcom/zuimeia_sdk_download/downloadprovider/R$string;->zuimeia_sdk_download_error:I

    .line 196
    :goto_26
    return v0

    .line 185
    :sswitch_27
    sget v0, Lcom/zuimeia_sdk_download/downloadprovider/R$string;->zuimeia_sdk_download_success:I

    goto :goto_26

    .line 188
    :sswitch_2a
    sget v0, Lcom/zuimeia_sdk_download/downloadprovider/R$string;->zuimeia_sdk_download_pending:I

    goto :goto_26

    .line 190
    :sswitch_2d
    sget v0, Lcom/zuimeia_sdk_download/downloadprovider/R$string;->zuimeia_sdk_download_running:I

    goto :goto_26

    .line 193
    :sswitch_30
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    iget v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mReasonColumnId:I

    invoke-interface {v0, v1}, Landroid/database/Cursor;->getInt(I)I

    move-result v0

    const/4 v1, 0x3

    if-ne v0, v1, :cond_3e

    .line 194
    sget v0, Lcom/zuimeia_sdk_download/downloadprovider/R$string;->zuimeia_sdk_download_queued:I

    goto :goto_26

    .line 196
    :cond_3e
    sget v0, Lcom/zuimeia_sdk_download/downloadprovider/R$string;->zuimeia_sdk_download_paused:I

    goto :goto_26

    .line 180
    nop

    :sswitch_data_42
    .sparse-switch
        0x1 -> :sswitch_2a
        0x2 -> :sswitch_2d
        0x4 -> :sswitch_30
        0x8 -> :sswitch_27
        0x10 -> :sswitch_24
    .end sparse-switch
.end method

.method private retrieveAndSetIcon(Landroid/view/View;)V
    .registers 13
    .param p1, "convertView"    # Landroid/view/View;

    .prologue
    const/4 v10, 0x0

    .line 203
    iget-object v7, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    iget v8, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mMediaTypeColumnId:I

    invoke-interface {v7, v8}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v5

    .line 204
    .local v5, "mediaType":Ljava/lang/String;
    iget-object v7, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    iget v8, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mLocalUriColumnId:I

    invoke-interface {v7, v8}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v4

    .line 205
    .local v4, "localUriColumnId":Ljava/lang/String;
    sget v7, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->download_icon:I

    invoke-virtual {p1, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ImageView;

    .line 206
    .local v1, "iconView":Landroid/widget/ImageView;
    const/4 v7, 0x4

    invoke-virtual {v1, v7}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 208
    if-nez v5, :cond_28

    .line 209
    sget v7, Lcom/zuimeia_sdk_download/downloadprovider/R$drawable;->zuimeia_sdk_download_icon_wait_pressed_selector:I

    invoke-virtual {v1, v7}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 210
    invoke-virtual {v1, v10}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 231
    :goto_27
    return-void

    .line 214
    :cond_28
    new-instance v2, Landroid/content/Intent;

    const-string v7, "android.intent.action.VIEW"

    invoke-direct {v2, v7}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 215
    .local v2, "intent":Landroid/content/Intent;
    const-string v7, "file"

    const-string v8, ""

    const/4 v9, 0x0

    invoke-static {v7, v8, v9}, Landroid/net/Uri;->fromParts(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v7

    invoke-virtual {v2, v7, v5}, Landroid/content/Intent;->setDataAndType(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;

    .line 216
    iget-object v7, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mContext:Landroid/content/Context;

    invoke-virtual {v7}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v6

    .line 217
    .local v6, "pm":Landroid/content/pm/PackageManager;
    const/high16 v7, 0x10000

    invoke-virtual {v6, v2, v7}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

    move-result-object v3

    .line 218
    .local v3, "list":Ljava/util/List;, "Ljava/util/List<Landroid/content/pm/ResolveInfo;>;"
    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v7

    if-nez v7, :cond_56

    .line 220
    sget v7, Lcom/zuimeia_sdk_download/downloadprovider/R$drawable;->zuimeia_sdk_download_icon_default_selector:I

    invoke-virtual {v1, v7}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 230
    :goto_52
    invoke-virtual {v1, v10}, Landroid/widget/ImageView;->setVisibility(I)V

    goto :goto_27

    .line 222
    :cond_56
    invoke-interface {v3, v10}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Landroid/content/pm/ResolveInfo;

    iget-object v7, v7, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    invoke-virtual {v7, v6}, Landroid/content/pm/ActivityInfo;->loadIcon(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    .line 223
    .local v0, "icon":Landroid/graphics/drawable/Drawable;
    invoke-static {v4}, Lcom/zuimeia/sdk/download/utils/AppIOUtil;->isApkFile(Ljava/lang/String;)Z

    move-result v7

    if-eqz v7, :cond_6e

    .line 224
    sget v7, Lcom/zuimeia_sdk_download/downloadprovider/R$drawable;->zuimeia_sdk_download_icon_default_selector:I

    invoke-virtual {v1, v7}, Landroid/widget/ImageView;->setImageResource(I)V

    goto :goto_52

    .line 226
    :cond_6e
    invoke-virtual {v1, v0}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    goto :goto_52
.end method

.method private setTextForView(Landroid/view/View;ILjava/lang/String;)V
    .registers 5
    .param p1, "parent"    # Landroid/view/View;
    .param p2, "textViewId"    # I
    .param p3, "text"    # Ljava/lang/String;

    .prologue
    .line 234
    invoke-virtual {p1, p2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    .line 235
    .local v0, "view":Landroid/widget/TextView;
    invoke-virtual {v0, p3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 236
    return-void
.end method


# virtual methods
.method public bindView(Landroid/view/View;)V
    .registers 19
    .param p1, "convertView"    # Landroid/view/View;

    .prologue
    .line 103
    move-object/from16 v0, p1

    instance-of v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem;

    if-nez v14, :cond_7

    .line 143
    :goto_6
    return-void

    .line 107
    :cond_7
    move-object/from16 v0, p0

    iget-object v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    move-object/from16 v0, p0

    iget v15, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mIdColumnId:I

    invoke-interface {v14, v15}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v6

    .local v6, "downloadId":J
    move-object/from16 v14, p1

    .line 108
    check-cast v14, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem;

    invoke-virtual {v14, v6, v7}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem;->setDownloadId(J)V

    .line 111
    invoke-direct/range {p0 .. p1}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->retrieveAndSetIcon(Landroid/view/View;)V

    .line 113
    move-object/from16 v0, p0

    iget-object v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    move-object/from16 v0, p0

    iget v15, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mTitleColumnId:I

    invoke-interface {v14, v15}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v11

    .line 115
    .local v11, "title":Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    move-object/from16 v0, p0

    iget v15, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mTotalBytesColumnId:I

    invoke-interface {v14, v15}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v12

    .line 116
    .local v12, "totalBytes":J
    move-object/from16 v0, p0

    iget-object v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    move-object/from16 v0, p0

    iget v15, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCurrentBytesColumnId:I

    invoke-interface {v14, v15}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v4

    .line 117
    .local v4, "currentBytes":J
    move-object/from16 v0, p0

    iget-object v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mCursor:Landroid/database/Cursor;

    move-object/from16 v0, p0

    iget v15, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mStatusColumnId:I

    invoke-interface {v14, v15}, Landroid/database/Cursor;->getInt(I)I

    move-result v10

    .line 118
    .local v10, "status":I
    invoke-virtual {v11}, Ljava/lang/String;->length()I

    move-result v14

    if-nez v14, :cond_5d

    .line 119
    move-object/from16 v0, p0

    iget-object v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mResources:Landroid/content/res/Resources;

    sget v15, Lcom/zuimeia_sdk_download/downloadprovider/R$string;->zuimeia_sdk_download_missing_title:I

    invoke-virtual {v14, v15}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v11

    .line 121
    :cond_5d
    sget v14, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->download_title:I

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    invoke-direct {v0, v1, v14, v11}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->setTextForView(Landroid/view/View;ILjava/lang/String;)V

    .line 123
    move-object/from16 v0, p0

    invoke-virtual {v0, v12, v13, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->getProgressValue(JJ)I

    move-result v8

    .line 125
    .local v8, "progress":I
    const/4 v14, 0x1

    if-ne v10, v14, :cond_d9

    const/4 v3, 0x1

    .line 126
    .local v3, "indeterminate":Z
    :goto_70
    sget v14, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->download_progress:I

    move-object/from16 v0, p1

    invoke-virtual {v0, v14}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v9

    check-cast v9, Landroid/widget/ProgressBar;

    .line 127
    .local v9, "progressBar":Landroid/widget/ProgressBar;
    invoke-virtual {v9, v3}, Landroid/widget/ProgressBar;->setIndeterminate(Z)V

    .line 128
    if-nez v3, :cond_82

    .line 129
    invoke-virtual {v9, v8}, Landroid/widget/ProgressBar;->setProgress(I)V

    .line 131
    :cond_82
    const/16 v14, 0x10

    if-eq v10, v14, :cond_8a

    const/16 v14, 0x8

    if-ne v10, v14, :cond_db

    .line 132
    :cond_8a
    const/16 v14, 0x8

    invoke-virtual {v9, v14}, Landroid/widget/ProgressBar;->setVisibility(I)V

    .line 137
    :goto_8f
    sget v14, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->size_text:I

    move-object/from16 v0, p0

    invoke-direct {v0, v12, v13}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->getSizeText(J)Ljava/lang/String;

    move-result-object v15

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    invoke-direct {v0, v1, v14, v15}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->setTextForView(Landroid/view/View;ILjava/lang/String;)V

    .line 138
    sget v14, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->status_text:I

    move-object/from16 v0, p0

    iget-object v15, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mResources:Landroid/content/res/Resources;

    move-object/from16 v0, p0

    invoke-direct {v0, v10}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->getStatusStringId(I)I

    move-result v16

    invoke-virtual/range {v15 .. v16}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v15

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    invoke-direct {v0, v1, v14, v15}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->setTextForView(Landroid/view/View;ILjava/lang/String;)V

    .line 139
    sget v14, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->last_modified_date:I

    invoke-direct/range {p0 .. p0}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->getDateString()Ljava/lang/String;

    move-result-object v15

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    invoke-direct {v0, v1, v14, v15}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->setTextForView(Landroid/view/View;ILjava/lang/String;)V

    .line 141
    sget v14, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->download_checkbox:I

    move-object/from16 v0, p1

    invoke-virtual {v0, v14}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/CheckBox;

    .line 142
    .local v2, "checkBox":Landroid/widget/CheckBox;
    move-object/from16 v0, p0

    iget-object v14, v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mDownloadSelectionListener:Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;

    invoke-interface {v14, v6, v7}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;->isDownloadSelected(J)Z

    move-result v14

    invoke-virtual {v2, v14}, Landroid/widget/CheckBox;->setChecked(Z)V

    goto/16 :goto_6

    .line 125
    .end local v2    # "checkBox":Landroid/widget/CheckBox;
    .end local v3    # "indeterminate":Z
    .end local v9    # "progressBar":Landroid/widget/ProgressBar;
    :cond_d9
    const/4 v3, 0x0

    goto :goto_70

    .line 134
    .restart local v3    # "indeterminate":Z
    .restart local v9    # "progressBar":Landroid/widget/ProgressBar;
    :cond_db
    const/4 v14, 0x0

    invoke-virtual {v9, v14}, Landroid/widget/ProgressBar;->setVisibility(I)V

    goto :goto_8f
.end method

.method public bindView(Landroid/view/View;Landroid/content/Context;Landroid/database/Cursor;)V
    .registers 4
    .param p1, "view"    # Landroid/view/View;
    .param p2, "context"    # Landroid/content/Context;
    .param p3, "cursor"    # Landroid/database/Cursor;

    .prologue
    .line 247
    invoke-virtual {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->bindView(Landroid/view/View;)V

    .line 248
    return-void
.end method

.method public getProgressValue(JJ)I
    .registers 8
    .param p1, "totalBytes"    # J
    .param p3, "currentBytes"    # J

    .prologue
    .line 165
    const-wide/16 v0, -0x1

    cmp-long v0, p1, v0

    if-nez v0, :cond_8

    .line 166
    const/4 v0, 0x0

    .line 168
    :goto_7
    return v0

    :cond_8
    const-wide/16 v0, 0x64

    mul-long/2addr v0, p3

    div-long/2addr v0, p1

    long-to-int v0, v0

    goto :goto_7
.end method

.method public newView()Landroid/view/View;
    .registers 5

    .prologue
    .line 96
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mContext:Landroid/content/Context;

    invoke-static {v1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v1

    sget v2, Lcom/zuimeia_sdk_download/downloadprovider/R$layout;->zuimeia_sdk_download_list_item:I

    const/4 v3, 0x0

    invoke-virtual {v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem;

    .line 97
    .local v0, "view":Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem;
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->mDownloadSelectionListener:Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;

    invoke-virtual {v0, v1}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem;->setSelectListener(Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadItem$DownloadSelectListener;)V

    .line 98
    return-object v0
.end method

.method public newView(Landroid/content/Context;Landroid/database/Cursor;Landroid/view/ViewGroup;)Landroid/view/View;
    .registers 5
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "cursor"    # Landroid/database/Cursor;
    .param p3, "parent"    # Landroid/view/ViewGroup;

    .prologue
    .line 242
    invoke-virtual {p0}, Lcom/zuimeia/sdk/download/providers/downloads/ui/DownloadAdapter;->newView()Landroid/view/View;

    move-result-object v0

    return-object v0
.end method
